{% assign menu = site.menu | sort:"weight"  %}
<div id="menu" class="menu">
    <ul>
        {% for node in menu %}
        <!-- begin menu -->
        <li>
        <!-- begin menu entry layer 1 -->
        
            <!-- title and link -->
            {% if node.url != null %}<a{% if page.url == node.url %} class="current"{% endif %} href="{{ node.url }}">{% endif %}
                {{ node.title }}
            {% if node.url != null %}</a>{% endif %}
        
            {% if node.sub != null %}
            <!-- sub menu -->
            <ul>
                {% assign sub = node.sub | sort:"weight"  %}
                    {% for subnode in sub %}
                        <li>
                            {% if subnode.url != null %}<a{% if page.url == subnode.url %} class="current"{% endif %} href="{{ subnode.url }}">{% endif %}
                                {{ subnode.title }}
                            {% if subnode.url != null %}</a>{% endif %}
                         
                            {% if subnode.sub != null %}
                            <ul>
                            {% assign subsub = subnode.sub | sort:"weight"  %}
                            {% for subsubnode in subsub %}
                            <li>
                                <a{% if page.url == subsubnode.url %} class="current"{% endif %} href="{{ subsubnode.url }}">
                                {{ subsubnode.title }}
                               </a>                
                            </li>
                            {% endfor %}
                            </ul>

                            {% endif %}
                    
                        </li>
                    {% endfor %}
            </ul>
            <!-- end sub menu -->
        {% endif %}
          <!-- end menu entry layer 1 -->
          </li>
      <!-- end menu -->
      {% endfor %}
    </ul>
</div>
